package memberarea.applogic2;

import memberarea.applogic.UserHelper;
import MemberAreas.pages.LoginPage;
import MemberAreas.model.User;

public class UserHelper2 extends DriverBasedHelper implements UserHelper {

  public UserHelper2(ApplicationManager2 manager) {
    super(manager.getWebDriver());
  }

  @Override
  public void loginAs(User user) {
    pages.loginPage.ensurePageLoaded()
      .setUsernameField(user.getEmail())
      .setPasswordField(user.getPassword())
      .clickSubmitButton();
  }

  @Override
  public void logout() {
    pages.internalPage.ensurePageLoaded()
      .clickLogoutLink();
  }

  @Override
  public boolean isLoggedIn() {
    return pages.internalPage.waitPageLoaded();
  }

  
  @Override
  public boolean isNotLoggedIn() {
    return pages.loginPage.waitPageLoaded();
  }



}
